package com.swift.authority.service.permission.impl;

import com.swift.authority.core.permission.dto.PermissionDto;
import com.swift.authority.core.permission.response.PermissionRes;
import com.swift.authority.mapper.permission.PermissionMapper;
import com.swift.authority.service.permission.PermissionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Administrator
 * @description :
 * @date 2022/06/18 16:22
 * @since open jdk 1.8
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    private Logger logger = LoggerFactory.getLogger(PermissionServiceImpl.class);
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public PermissionRes queryPermissionInfoByPid(int pid) {
        logger.info("获取用户权限信息,pid:{}",pid);

        PermissionDto permissionDto = permissionMapper.queryPermissionInfoByPid(pid);
        PermissionRes permissionRes = new PermissionRes();
        BeanUtils.copyProperties(permissionDto,permissionRes,PermissionRes.class);
        return permissionRes;
    }
}
